using LitJson;
using UnityEngine;

namespace abilities.triggers.conditions
{
    public class AbilityTriggerConditionChance : AbilityTriggerCondition
    {
        public int chance;

        public override bool FromJson(JsonData value)
        {
            chance = (int)value["chance"];
            return true;
        }

        public override bool Check(AbilityContext context)
        {
            return Random.value * 100 < (int) chance;
        }
    }
}